package com.efast.dmom.equipment.statemach.handler.repair;

import java.util.Date;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.efast.cafe.commponent.statemach.annotation.StatemachHandle;
import com.efast.cafe.commponent.statemach.base.HandleBaseProcessorService;
import com.efast.cafe.framework.jdbc.JdbcDao;
import com.efast.cafe.framework.util.SpringWebUtils;
import com.efast.dmom.equipment.entity.EquipRepairOrder;

/**
 * @author Administrator
 * 维修单保存操作的扩展
 */
@Component
@StatemachHandle(handleName = "savedraft", configId = 1010, entityName = "equip_repair_order")
public class EquipRepairOrderDraftHandler implements HandleBaseProcessorService<EquipRepairOrder> {

	@Autowired
	private JdbcDao jdbcDao;

	@Override
	public void process(JSONObject taskBean, EquipRepairOrder repairOrder, Map<String, JSONObject> extFormDataJson) {
		repairOrder.setCreateUser(SpringWebUtils.getRequestUser());
		repairOrder.setCompanyCode(SpringWebUtils.getRequestCompany());
		String orderNumber = jdbcDao.executeProcGetCode("WX", SpringWebUtils.getRequestCompany());
		repairOrder.setReportor(SpringWebUtils.getRequestUser());
		repairOrder.setReportTime(new Date());
		repairOrder.setOrderNumber(orderNumber);

	}

}
